C SOURCES:
C    John P. Perdew, Kieron Burke, and Matthias Ernzerhof.
C    Generalized gradient approximation made simple.
C    Physical Review Letters, 77(18):3865-3868, oct 1996.



C*****************************************************************************
      pure subroutine ESRC_PBE(rho_c, gamma_cc, E)
C*****************************************************************************
C   Implemented by E.R. Kjellgren.
C
C   Subroutine generated using Sympy 1.3
C   Generated: March 25, 2019
C*****************************************************************************
      implicit none
      real*8, intent(in) :: rho_c, gamma_cc
      real*8, intent(out) :: E
      real*8 :: x0, x1, x2, x3, x4, x5, x6, x7
      E = 0.0d0
      x0 = 9.86960440108936d0
      x1 = 0.306852819440055d0
      x2 = 0.682784063255296d0*rho_c**(-0.333333333333333d0)
      x3 = 1d0/x1
      x4 = 2.0d0*(0.194159335344114d0*x2 + 1.0d0)*log(0.5d0*x0*x3/( 0.18
     &970043257475587d0*rho_c**(-0.66666666666666663d0) + 0.800428634999
     &36346d0*rho_c**(-0.5d0) + 5.9825504357710791d0* rho_c**(-0.1666666
     &6666666666d0) + 3.2595509194222925d0*x2) + 1.0d0)
      x5 = exp(x4) - 1.0d0
      x6 = 0.041796946103773d0*gamma_cc*rho_c**(-2.33333333333333d0)*x3
      x7 = 1.0d0 + x6/x5
      E = -rho_c*x1*(x4 - 1.0d0*log(x6*x7/(0.0017469847036017068d0*gamma
     &_cc**2* rho_c**(-4.666666666666667d0)/(x1**2*x5**2) + x7) + 1.0d0)
     &)/x0
      end subroutine


C*****************************************************************************
      pure subroutine D1ESRC_PBE(rho_c, gamma_cc, E, d1E)
C*****************************************************************************
C   Implemented by E.R. Kjellgren.
C
C   Subroutine generated using Sympy 1.3
C   Generated: March 25, 2019
C*****************************************************************************
      implicit none
      real*8, intent(in) :: rho_c, gamma_cc
      real*8, intent(out) :: E, d1E(9)
      real*8 :: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x
     &13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x2
     &6, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39
     &, x40, x41, x42, x43, x44
      E = 0.0d0
      d1E(:) = 0.0d0
      x0 = 0.466194077035412d0
      x1 = 0.564189583547756d0
      x2 = 0.682784063255296d0
      x3 = rho_c**(-0.333333333333333d0)*x2
      x4 = 0.826307487110758d0
      x5 = 0.406913004517529d0*rho_c**(-0.666666666666667d0)*x0 + 1.4187
     &2281647967d0*rho_c**(-0.5d0)*x1 + 7.24010193431683d0*rho_c **(-0.1
     &66666666666667d0)*x4 + 3.25955091942229d0*x3
      x6 = 9.86960440108936d0
      x7 = 0.306852819440055d0
      x8 = 1d0/x7
      x9 = x6*x8
      x10 = x9/x5
      x11 = log(0.5d0*x10 + 1.0d0)
      x12 = 0.388318670688228d0*x3 + 2.0d0
      x13 = x11*x12
      x14 = gamma_cc*x8
      x15 = exp(x13)
      x16 = x15 - 1.0d0
      x17 = 208.945363813799d0
      x18 = rho_c**(-4.66666666666667d0)*x17
      x19 = 8.36096418563526d-6*x18
      x20 = x19/x16**2
      x21 = 14.4549425392770d0
      x22 = rho_c**(-2.33333333333333d0)
      x23 = x21*x22
      x24 = 0.00289153318944038d0*x23
      x25 = 1d0/x16
      x26 = x14*x25
      x27 = x24*x26 + 1.0d0
      x28 = 1d0/(gamma_cc**2*x20/x7**2 + x27)
      x29 = x24*x27
      x30 = x28*x29
      x31 = x14*x30 + 1.0d0
      x32 = 1.0d0*log(x31)
      x33 = 1d0/x6
      x34 = x33*x7
      x35 = rho_c**(-1.33333333333333d0)
      x36 = x2*x35
      x37 = (0.27127533634502d0*rho_c**(-1.66666666666667d0)*x0 + 0.7093
     &61408239834d0*rho_c**(-1.5d0)*x1 + 1.20668365571947d0*rho_c **(-1.
     &16666666666667d0)*x4 + 1.08651697314076d0*x36)/(x5**2*(x10 + 2.0d0
     &))
      x38 = 0.00674691077536089d0*rho_c**(-3.33333333333333d0)
      x39 = x21*x38
      x40 = x22*x25
      x41 = x15*(-0.258879113792152d0*x11*x36 + 2.0d0*x37*x9*(0.38831867
     &0688228d0*x3 + 2.0d0))
      x42 = 0.00144576659472019d0*x41
      x43 = x26*x30
      x44 = 1.0d0*x28*x33/x31
      E = -rho_c*x34*(x13 - x32)
      d1E(1) = -rho_c*(gamma_cc*x44*(0.00289153318944038d0*x14*x17*x40*(
     &x38 + x40*x42) + x27*x39 - x43*(3.90178328662979d-5*rho_c**(-5.666
     &66666666667d0) *x17*x26 + x14*x20*x41 + x23*x25*x42 + x39)) - 0.12
     &9439556896076d0*x11*x35*x7/x21 + x12*x37) - x13*x34 + x32*x34
      d1E(3) = rho_c*x44*(x19*x26 + x29 - x43*(1.67219283712705d-5*x18*x
     &26 + x24))
      end subroutine


C*****************************************************************************
      pure subroutine D2ESRC_PBE(rho_c, gamma_cc, E, d1E, d2E)
C*****************************************************************************
C   Implemented by E.R. Kjellgren.
C
C   Subroutine generated using Sympy 1.3
C   Generated: March 25, 2019
C*****************************************************************************
      implicit none
      real*8, intent(in) :: rho_c, gamma_cc
      real*8, intent(out) :: E, d1E(9), d2E(45)
      real*8 :: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x
     &13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x2
     &6, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39
     &, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x50, x51, x52,
     & x53, x54, x55, x56, x57, x58, x59, x60, x61, x62, x63, x64, x65, 
     &x66, x67, x68, x69, x70, x71, x72, x73, x74, x75, x76, x77, x78, x
     &79, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x90, x91, x9
     &2, x93, x94, x95, x96, x97, x98, x99, x100, x101, x102, x103, x104
     &, x105, x106, x107, x108, x109, x110, x111, x112, x113, x114, x115
     &, x116, x117, x118, x119, x120, x121, x122, x123, x124, x125, x126
     &, x127, x128, x129, x130, x131
      E = 0.0d0
      d1E(:) = 0.0d0
      d2E(:) = 0.0d0
      x0 = 0.682784063255296d0
      x1 = rho_c**(-0.333333333333333d0)*x0
      x2 = 0.194159335344114d0*x1 + 1.0d0
      x3 = 0.466194077035412d0
      x4 = 0.564189583547756d0
      x5 = 1.41872281647967d0*x4
      x6 = 0.826307487110758d0
      x7 = 0.406913004517529d0*rho_c**(-0.666666666666667d0)*x3 + rho_c*
     &*(-0.5d0)* x5 + 7.24010193431683d0*rho_c**(-0.166666666666667d0)*x
     &6 + 3.25955091942229d0*x1
      x8 = 9.86960440108936d0
      x9 = 0.306852819440055d0
      x10 = 1d0/x9
      x11 = x10*x8
      x12 = x11/x7
      x13 = log(0.5d0*x12 + 1.0d0)
      x14 = x13*x2
      x15 = 2.0d0*x14
      x16 = gamma_cc*x10
      x17 = exp(x15)
      x18 = x17 - 1.0d0
      x19 = x18**(-2)
      x20 = 208.945363813799d0
      x21 = rho_c**(-4.66666666666667d0)*x20
      x22 = 8.36096418563526d-6*x21
      x23 = x19*x22
      x24 = gamma_cc**2
      x25 = x9**(-2)
      x26 = x24*x25
      x27 = x23*x26
      x28 = 14.4549425392770d0
      x29 = rho_c**(-2.33333333333333d0)
      x30 = x28*x29
      x31 = 0.00289153318944038d0*x30
      x32 = 1d0/x18
      x33 = x16*x32
      x34 = x31*x33 + 1.0d0
      x35 = x27 + x34
      x36 = 1d0/x35
      x37 = x31*x34
      x38 = x36*x37
      x39 = x16*x38 + 1.0d0
      x40 = 1.0d0*log(x39)
      x41 = 1d0/x8
      x42 = x41*x9
      x43 = rho_c**(-1.33333333333333d0)
      x44 = 0.129439556896076d0*x43
      x45 = 1d0/x28
      x46 = x13*x45*x9
      x47 = 2.0d0*x2
      x48 = rho_c**(-1.66666666666667d0)*x3
      x49 = rho_c**(-1.5d0)
      x50 = x0*x43
      x51 = rho_c**(-1.16666666666667d0)*x6
      x52 = 0.709361408239834d0*x4*x49 + 0.27127533634502d0*x48 + 1.0865
     &1697314076d0 *x50 + 1.20668365571947d0*x51
      x53 = x12 + 2.0d0
      x54 = 1d0/x53
      x55 = x54/x7**2
      x56 = x52*x55
      x57 = 0.258879113792152d0*x13
      x58 = x50*x57
      x59 = 0.388318670688228d0*x1 + 2.0d0
      x60 = x11*x59
      x61 = 2.0d0*x56*x60
      x62 = -x58 + x61
      x63 = x17*x32
      x64 = 0.00144576659472019d0*x30
      x65 = x62*x63*x64
      x66 = x16*x17
      x67 = x23*x66
      x68 = rho_c**(-3.33333333333333d0)
      x69 = 0.00674691077536089d0*x68
      x70 = x28*x69
      x71 = rho_c**(-5.66666666666667d0)
      x72 = x20*x33
      x73 = x71*x72
      x74 = x70 + 3.90178328662979d-5*x73
      x75 = x62*x67 + x65 + x74
      x76 = x33*x38
      x77 = -x75*x76
      x78 = x34*x70
      x79 = 0.00144576659472019d0*x29
      x80 = x63*x79
      x81 = x62*x80 + x69
      x82 = 0.00289153318944038d0*x29*x72
      x83 = x78 + x81*x82
      x84 = x77 + x83
      x85 = x36/x39
      x86 = x41*x85
      x87 = gamma_cc*x86
      x88 = 1.67219283712705d-5*x21
      x89 = x33*x88
      x90 = x31 + x89
      x91 = x36*x90
      x92 = x33*x91
      x93 = x22*x33 - x37*x92 + x37
      x94 = 1.0d0*x86
      x95 = rho_c*x94
      x96 = x58 - x61
      x97 = x63*x96
      x98 = -x64*x97 - x67*x96 + x74
      x99 = -x76*x98
      x100 = x83 + x99
      x101 = rho_c**(-2.33333333333333d0)
      x102 = x0*x101
      x103 = x55*(0.452125560575033d0*rho_c**(-2.66666666666667d0)*x3 + 
     &1.06404211235975d0*rho_c**(-2.5d0)*x4 + 1.40779759833938d0*rho_c *
     &*(-2.16666666666667d0)*x6 + 1.44868929752102d0*x102)
      x104 = x52**2/(x53**2*x7**4)
      x105 = x52*x54*(0.542550672690039d0*x48 + x49*x5 + 2.1730339462815
     &3d0*x50 + 2.41336731143894d0*x51)/x7**3
      x106 = x35**(-2)
      x107 = x69 - x80*x96
      x108 = 0.0224897025845363d0*rho_c**(-4.33333333333333d0)
      x109 = x108*x28
      x110 = 0.0134938215507218d0*x68
      x111 = x110*x28
      x112 = x33*x34*x36
      x113 = 0.00578306637888076d0*x29
      x114 = x19*x26
      x115 = x114*x20
      x116 = x96**2
      x117 = x116*exp(4.0d0*x14)
      x118 = x117*x19
      x119 = 0.000722883297360095d0*x63
      x120 = x119*x29
      x121 = 4.0d0*x60
      x122 = 6.97814718907709d0*x10*x43*x56 - 0.690344303445739d0*x102*x
     &13 + x103* x121 + 389.63636413601d0*x104*x25*x59 - x105*x121
      x123 = 7.80356657325958d-5*x73
      x124 = x19*x66
      x125 = x124*x96
      x126 = x106*x37
      x127 = x114*x126
      x128 = x119*x30
      x129 = 4.18048209281763d-6*x124*x21
      x130 = 0.00578306637888076d0*x30
      x131 = x130 + 3.34438567425411d-5*x21*x33
      E = -rho_c*x42*(x15 - x40)
      d1E(1) = -rho_c*(-x44*x46 + x47*x56 + 1.0d0*x84*x87) - x15*x42 + x
     &40*x42
      d1E(3) = x93*x95
      d2E(1) = rho_c*(-1.0d0*x10*x100*x106*x24*x41*(x107*x82 + x78 + x99
     &)/x39**2 - 0.172586075861435d0*x101*x46 + x103*x47 + x104*x11*x47 
     &- x105*x47 + 0.682784063255296d0*x44*x56 + 0.129439556896076d0*x50
     &*x56 + x87 *(x107*x110*x72 - x107*x113*x115*x36*x98 + x109*x34 - x
     &111*x112* x98 + x127*x98*(x111 + x123 - x125*x88 - x31*x97) - x76*
     &( 0.000221101052909021d0*rho_c**(-6.66666666666667d0)*x72 + x109 -
     & x116*x128 - x116*x129 + 1.25414462784529d-5*x117*x16*x21/x18**3 +
     & x118*x64 + x122*x128 + x122*x129 - 7.80356657325958d-5*x125*x20* 
     &x71 - x70*x97) + x82*(x108 - x116*x120 + x118*x79 + x120*x122 - x6
     &9*x97))) - 2.0d0*x100*x87 - 4.0d0*x2*x56 + x43*x45*x57*x9
      d2E(4) = x94*(-rho_c*(x113*x72*x81 - 0.00289153318944038d0*x115*x2
     &9*x81*x91 + x127*x131*x75 - x16*x84*x85*x93 - x27*x36*x75 + 1.9508
     &916433149d-5*x73 - x76*(x123 + x124*x62*x88 + x65 + x70) + x77 - x
     &78*x92 + x78) + x93)
      d2E(6) = -x10*x95*(x32*(0.000146037251001113d0*rho_c**(-7.0d0)*x11
     &2 - x126*x131* x33*x90 + x130*x34*x91 - x88 + x89*x91) + x85*x93**
     &2)
      end subroutine


C*****************************************************************************
      pure subroutine ESRC_SPIN_PBE(rho_c, rho_s, gamma_cc, E)
C*****************************************************************************
C   Implemented by E.R. Kjellgren.
C
C   Subroutine generated using Sympy 1.3
C   Generated: March 25, 2019
C*****************************************************************************
      implicit none
      real*8, intent(in) :: rho_c, rho_s, gamma_cc
      real*8, intent(out) :: E
      real*8 :: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x
     &13, x14, x15, x16, x17, x18, x19, x20, x21, x22
      E = 0.0d0
      x0 = rho_s/rho_c
      x1 = x0 + 1.0d0
      x2 = -x0 + 1.0d0
      x3 = x1**0.666666666666667d0 + x2**0.666666666666667d0
      x4 = x3**3
      x5 = 0.306852819440055d0
      x6 = 0.682784063255296d0*rho_c**(-0.333333333333333d0)
      x7 = 0.466194077035412d0*rho_c**(-0.666666666666667d0)
      x8 = 0.564189583547756d0*rho_c**(-0.5d0)
      x9 = 0.826307487110758d0*rho_c**(-0.166666666666667d0)
      x10 = 9.86960440108936d0
      x11 = 1d0/x5
      x12 = x10*x11
      x13 = (0.186690969707574d0*x6 + 1.0d0)*log(x12/(5.630984149097876d
     &0*x6 + 0.51606646454786342d0*x7 + 2.9152147142191778d0*x8 + 13.457
     &913714394447d0*x9) + 1.0d0)
      x14 = 2.0d0*(0.194159335344114d0*x6 + 1.0d0)*log(0.5d0*x12/( 3.259
     &5509194222925d0*x6 + 0.40691300451752932d0*x7 + 1.4187228164796675
     &d0*x8 + 7.2401019343168302d0*x9) + 1.0d0)
      x15 = 1.92366105093154d0*x1**1.33333333333333d0 + 1.92366105093154
     &d0*x2** 1.33333333333333d0 - 3.84732210186307d0
      x16 = rho_s**4/rho_c**4
      x17 = x5/x10
      x18 = x15*x16*x17
      x19 = -x14*x17 + 0.0197517897025652d0*x15*(-x16 + 1.0d0)*(0.101077
     &332976288d0* x6 + 1.0d0)*log(1.0d0 + 29.608574643216677d0/( 3.2918
     &048099450625d0*x6 + 0.41002507094961249d0*x7 + 0.76232752193529008
     &d0*x8 + 9.8721297225692712d0*x9))
      x20 = 1.0d0 - exp(-8.0d0*x12*(x18*(-x13 + x14) + x19)/x4)
      x21 = 0.167187784415092d0*gamma_cc*rho_c**(-2.33333333333333d0)*x1
     &1/x3**2
      x22 = 1.0d0 - x21/x20
      E = rho_c*(0.125d0*x17*x4*log(x21*x22/(0.027951755257627309d0*gamm
     &a_cc**2* rho_c**(-4.666666666666667d0)/(x20**2*x3**4*x5**2) + x22)
     & + 1.0d0 ) - x18*(x13 - x14) + x19)
      end subroutine


C*****************************************************************************
      pure subroutine D1ESRC_SPIN_PBE(rho_c, rho_s, gamma_cc, E, d1E)
C*****************************************************************************
C   Implemented by E.R. Kjellgren.
C
C   Subroutine generated using Sympy 1.3
C   Generated: March 25, 2019
C*****************************************************************************
      implicit none
      real*8, intent(in) :: rho_c, rho_s, gamma_cc
      real*8, intent(out) :: E, d1E(9)
      real*8 :: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x
     &13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x2
     &6, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39
     &, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x50, x51, x52,
     & x53, x54, x55, x56, x57, x58, x59, x60, x61, x62, x63, x64, x65, 
     &x66, x67, x68, x69, x70, x71, x72, x73, x74, x75, x76, x77, x78, x
     &79, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x90, x91, x9
     &2, x93, x94, x95, x96, x97, x98, x99, x100, x101, x102, x103, x104
     &, x105, x106, x107, x108, x109, x110, x111, x112, x113, x114, x115
     &, x116, x117, x118, x119, x120, x121, x122, x123, x124, x125, x126
     &, x127, x128, x129, x130, x131, x132, x133, x134, x135, x136, x137
     &, x138, x139, x140, x141, x142, x143, x144, x145, x146, x147, x148
     &, x149, x150, x151, x152, x153, x154, x155, x156, x157, x158, x159
     &, x160, x161, x162, x163, x164, x165
      E = 0.0d0
      d1E(:) = 0.0d0
      x0 = 1d0/rho_c
      x1 = rho_s*x0
      x2 = x1 + 1.0d0
      x3 = -x1 + 1.0d0
      x4 = x2**0.666666666666667d0 + x3**0.666666666666667d0
      x5 = x4**3
      x6 = 0.306852819440055d0
      x7 = 1d0/x6
      x8 = x4**2
      x9 = x7/x8
      x10 = gamma_cc*x9
      x11 = 0.682784063255296d0
      x12 = rho_c**(-0.333333333333333d0)*x11
      x13 = 0.186690969707574d0*x12 + 1.0d0
      x14 = 0.466194077035412d0
      x15 = rho_c**(-0.666666666666667d0)*x14
      x16 = 0.564189583547756d0
      x17 = rho_c**(-0.5d0)*x16
      x18 = 0.826307487110758d0
      x19 = rho_c**(-0.166666666666667d0)*x18
      x20 = 5.63098414909788d0*x12 + 0.516066464547863d0*x15 + 2.9152147
     &1421918d0* x17 + 13.4579137143944d0*x19
      x21 = 9.86960440108936d0
      x22 = x21*x7
      x23 = 1.0d0 + x22/x20
      x24 = log(x23)
      x25 = x13*x24
      x26 = 3.25955091942229d0*x12 + 0.406913004517529d0*x15 + 1.4187228
     &1647967d0* x17 + 7.24010193431683d0*x19
      x27 = x22/x26
      x28 = log(0.5d0*x27 + 1.0d0)
      x29 = 0.388318670688228d0*x12 + 2.0d0
      x30 = x28*x29
      x31 = -x25 + x30
      x32 = 1.92366105093154d0*x2**1.33333333333333d0 + 1.92366105093154
     &d0*x3** 1.33333333333333d0 - 3.84732210186307d0
      x33 = rho_c**(-4)
      x34 = rho_s**4
      x35 = x33*x34
      x36 = x32*x35
      x37 = 1d0/x21
      x38 = x37*x6
      x39 = x36*x38
      x40 = x31*x39
      x41 = x30*x38
      x42 = -x35 + 1.0d0
      x43 = 0.101077332976288d0*x12 + 1.0d0
      x44 = 3.29180480994506d0*x12 + 0.410025070949612d0*x15 + 0.7623275
     &2193529d0* x17 + 9.87212972256927d0*x19
      x45 = 1.0d0 + 29.6085746432167d0/x44
      x46 = log(x45)
      x47 = x43*x46
      x48 = x42*x47
      x49 = 0.0197517897025652d0*x32*x48
      x50 = -x41 + x49
      x51 = x40 + x50
      x52 = 1d0/x5
      x53 = 8.0d0*x22*x52
      x54 = exp(-x51*x53)
      x55 = -x54 + 1.0d0
      x56 = x6**(-2)
      x57 = x56/x4**4
      x58 = 208.945363813799d0
      x59 = rho_c**(-4.66666666666667d0)
      x60 = x58*x59
      x61 = 0.000133775426970164d0*x60
      x62 = gamma_cc**2*x57*x61
      x63 = 1d0/x55
      x64 = 14.4549425392770d0
      x65 = rho_c**(-2.33333333333333d0)
      x66 = 0.0115661327577615d0*x65
      x67 = x64*x66
      x68 = x10*x67
      x69 = -x63*x68 + 1.0d0
      x70 = 1d0/(x69 + x62/x55**2)
      x71 = x67*x69
      x72 = x70*x71
      x73 = x10*x72 + 1.0d0
      x74 = x38*log(x73)
      x75 = x25 - x30
      x76 = -x39*x75 + 0.125d0*x5*x74 + x50
      x77 = rho_c**(-1.66666666666667d0)*x14
      x78 = rho_c**(-1.5d0)*x16
      x79 = rho_c**(-1.33333333333333d0)
      x80 = x11*x79
      x81 = rho_c**(-1.16666666666667d0)*x18
      x82 = x13*(0.344044309698576d0*x77 + 1.45760735710959d0*x78 + 1.87
     &699471636596d0*x80 + 2.24298561906574d0*x81)/(x20**2*x23)
      x83 = x6*x79/x64
      x84 = 0.062230323235858d0*x24*x83
      x85 = x29*(0.27127533634502d0*x77 + 0.709361408239834d0*x78 + 1.08
     &651697314076d0*x80 + 1.20668365571947d0*x81)/(x26**2*(x27 + 2.0d0)
     &)
      x86 = 0.129439556896076d0*x28*x83
      x87 = -x85 + x86
      x88 = x34/rho_c**5
      x89 = 0.0790071588102608d0*x32*x47
      x90 = x88*x89
      x91 = x32*x42
      x92 = 0.000665486074881265d0*x46*x80
      x93 = 4.0d0*x32
      x94 = x38*x75
      x95 = x88*x94
      x96 = 0.58482233974552d0*x43*(0.273350047299742d0*x77 + 0.38116376
     &0967645d0* x78 + 1.09726826998169d0*x80 + 1.64535495376155d0*x81)/
     &(x44**2* x45)
      x97 = x3**0.333333333333333d0
      x98 = x2**0.333333333333333d0
      x99 = x97 - x98
      x100 = 0.0506609980493537d0*x99
      x101 = x100*x48
      x102 = rho_s/rho_c**2
      x103 = x54 - 1.0d0
      x104 = 1d0/x103
      x105 = x104*x68 + 1.0d0
      x106 = rho_c**(-3.33333333333333d0)
      x107 = 0.0269876431014436d0*x106
      x108 = x3**(-0.333333333333333d0)
      x109 = x2**(-0.333333333333333d0)
      x110 = -x109
      x111 = x108 + x110
      x112 = 0.015421510343682d0*x111
      x113 = x105*x112
      x114 = 1d0/x4
      x115 = rho_c**(-4.33333333333333d0)*rho_s*x114
      x116 = x107*x64
      x117 = -x40 + x41 - x49
      x118 = 1.0d0*x108
      x119 = 2.0d0*x114
      x120 = x102*x119
      x121 = x85 - x86
      x122 = x35 - 1.0d0
      x123 = x122*x32
      x124 = x31*x38
      x125 = x124*x93
      x126 = x122*x47
      x127 = 2.56488140124205d0*x99
      x128 = rho_s**5*x127/rho_c**6
      x129 = x100*x102*x126 + x121 - x123*x92 + x123*x96 - x124*x128 + x
     &125*x88 - x36 *(x121 - x82 + x84) - x90
      x130 = x52*x7
      x131 = x130*x65
      x132 = exp(x117*x53)
      x133 = x132 - 1.0d0
      x134 = 1d0/x133
      x135 = 13.2006183429726d0
      x136 = x132*x134*x135
      x137 = x10*x134
      x138 = x112*x64
      x139 = x10*x104
      x140 = rho_c**(-5.66666666666667d0)
      x141 = x140*x58
      x142 = 0.000356734471920438d0*x111
      x143 = x110 + x118
      x144 = x120*x143*x51 + x129
      x145 = x135*x54
      x146 = x103**(-2)
      x147 = 4.41396426734162d0*gamma_cc
      x148 = x104*x9
      x149 = gamma_cc/(x105 + x146*x62)
      x150 = x105*x149
      x151 = 0.18307398594519d0*x149
      x152 = x4/x73
      x153 = x108 - 1.0d0*x109
      x154 = 0.25d0*x8
      x155 = rho_s**3
      x156 = x155*x89
      x157 = x93*x94
      x158 = x150*x9
      x159 = x158*x67 + 1.0d0
      x160 = rho_c**(-3)
      x161 = x156*x160
      x162 = x155*x160
      x163 = x119*x153
      x164 = -x97 + x98
      x165 = x117*x163 - 2.56488140124205d0*x124*x164*x35 - x125*x162 + 
     &0.0506609980493537d0*x126*x164 + x161
      E = rho_c*x76
      d1E(1) = rho_c*(x101*x102 + x102*x153*x154*x74 - x128*x94 - x151*x
     &152*(x105*x107 + x113*x115 + x137*x66*(-0.015421510343682d0*x115*x
     &64*(-x108 + x109) + x116 + x131*x136*(x117*x120*(x109 - x118) + x1
     &29)) - x148 *x150*x66*(gamma_cc*rho_c**(-6.66666666666667d0)*rho_s
     &*x104*x130* x142*x58 + x104*x131*x144*x145 + x115*x138 + x116 + 0.
     &000624285325860766d0*x139*x141 + x144*x146*x147*x54*x56*x59/x4 **5
     &)) - x36*(x82 - x84 + x87) + x87 + x90 - x91*x92 + x91*x96 + x93*x
     &95) + x76
      d1E(2) = -rho_c*(x0*x101 + x0*x143*x154*x38*log(x159) - x127*x95 -
     & x151*(x106* x113 - x134*x158*x66*(-x106*x136*x165*x9 + x106*x138 
     &- x132*x140* x147*x165*x57/x133**2 + x137*x141*x142) + 0.011566132
     &7577615d0* x139*x140*(x138 - x145*x148*(x101 - x127*x35*x94 + x157
     &*x162 + x161 - x163*x51)))/x159 + x155*x157*x33 + x156*x33)
      d1E(3) = 0.125d0*rho_c*x152*x37*x70*(-x10*x61*x63 - x139*x72*( 0.0
     &00267550853940328d0*x139*x60 + x67) + x71)
      end subroutine


C*****************************************************************************
      pure subroutine D2ESRC_SPIN_PBE(rho_c, rho_s, gamma_cc, E, d1E, d2
     &E)
C*****************************************************************************
C   Implemented by E.R. Kjellgren.
C
C   Subroutine generated using Sympy 1.3
C   Generated: March 25, 2019
C*****************************************************************************
      implicit none
      real*8, intent(in) :: rho_c, rho_s, gamma_cc
      real*8, intent(out) :: E, d1E(9), d2E(45)
      real*8 :: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x
     &13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x2
     &6, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39
     &, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x50, x51, x52,
     & x53, x54, x55, x56, x57, x58, x59, x60, x61, x62, x63, x64, x65, 
     &x66, x67, x68, x69, x70, x71, x72, x73, x74, x75, x76, x77, x78, x
     &79, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x90, x91, x9
     &2, x93, x94, x95, x96, x97, x98, x99, x100, x101, x102, x103, x104
     &, x105, x106, x107, x108, x109, x110, x111, x112, x113, x114, x115
     &, x116, x117, x118, x119, x120, x121, x122, x123, x124, x125, x126
     &, x127, x128, x129, x130, x131, x132, x133, x134, x135, x136, x137
     &, x138, x139, x140, x141, x142, x143, x144, x145, x146, x147, x148
     &, x149, x150, x151, x152, x153, x154, x155, x156, x157, x158, x159
     &, x160, x161, x162, x163, x164, x165, x166, x167, x168, x169, x170
     &, x171, x172, x173, x174, x175, x176, x177, x178, x179, x180, x181
     &, x182, x183, x184, x185, x186, x187, x188, x189, x190, x191, x192
     &, x193, x194, x195, x196, x197, x198, x199, x200, x201, x202, x203
     &, x204, x205, x206, x207, x208, x209, x210, x211, x212, x213, x214
     &, x215, x216, x217, x218, x219, x220, x221, x222, x223, x224, x225
     &, x226, x227, x228, x229, x230, x231, x232, x233, x234, x235, x236
     &, x237, x238, x239, x240, x241, x242, x243, x244, x245, x246, x247
     &, x248, x249, x250, x251, x252, x253, x254, x255, x256, x257, x258
     &, x259, x260, x261, x262, x263, x264, x265, x266, x267, x268, x269
     &, x270, x271, x272, x273, x274, x275, x276, x277, x278, x279, x280
     &, x281, x282, x283, x284, x285, x286, x287, x288, x289, x290, x291
     &, x292, x293, x294, x295, x296, x297, x298, x299, x300, x301, x302
     &, x303, x304, x305, x306, x307, x308, x309, x310, x311, x312, x313
     &, x314, x315, x316, x317, x318, x319, x320, x321, x322, x323, x324
     &, x325, x326, x327, x328, x329, x330, x331, x332, x333, x334, x335
     &, x336, x337, x338, x339, x340, x341, x342, x343, x344, x345, x346
     &, x347, x348, x349, x350, x351, x352, x353, x354, x355, x356, x357
     &, x358, x359, x360, x361, x362, x363, x364, x365, x366, x367, x368
     &, x369, x370, x371, x372, x373, x374, x375, x376, x377, x378, x379
     &, x380, x381, x382, x383, x384, x385, x386, x387, x388, x389, x390
     &, x391, x392, x393, x394, x395, x396, x397, x398, x399, x400, x401
     &, x402, x403, x404, x405, x406, x407, x408, x409, x410, x411, x412
     &, x413, x414, x415, x416, x417, x418, x419, x420, x421, x422, x423
     &, x424, x425, x426, x427, x428, x429, x430, x431, x432, x433, x434
     &, x435, x436, x437, x438, x439, x440, x441, x442, x443, x444, x445
     &, x446, x447, x448, x449, x450, x451, x452, x453, x454, x455, x456
     &, x457, x458, x459, x460, x461, x462, x463, x464, x465, x466, x467
     &, x468, x469, x470, x471, x472, x473, x474, x475, x476, x477, x478
     &, x479, x480, x481, x482, x483, x484, x485, x486, x487, x488, x489
     &, x490, x491, x492, x493, x494, x495, x496, x497, x498, x499, x500
     &, x501, x502, x503, x504, x505, x506, x507, x508, x509, x510, x511
     &, x512, x513, x514, x515, x516, x517, x518, x519, x520, x521, x522
     &, x523, x524, x525, x526, x527, x528, x529, x530, x531, x532, x533
     &, x534, x535, x536, x537, x538, x539, x540, x541, x542, x543, x544
     &, x545, x546, x547, x548, x549, x550, x551, x552, x553, x554, x555
     &, x556, x557, x558, x559, x560, x561, x562, x563, x564, x565, x566
     &, x567, x568, x569, x570, x571, x572, x573, x574, x575, x576, x577
     &, x578, x579, x580, x581, x582, x583, x584, x585, x586, x587, x588
     &, x589, x590, x591, x592, x593, x594, x595, x596, x597, x598, x599
     &, x600, x601, x602, x603, x604, x605, x606, x607, x608, x609, x610
     &, x611, x612, x613, x614, x615, x616, x617, x618, x619, x620, x621
     &, x622, x623, x624, x625, x626, x627
      E = 0.0d0
      d1E(:) = 0.0d0
      d2E(:) = 0.0d0
      x0 = 1d0/rho_c
      x1 = rho_s*x0
      x2 = x1 + 1.0d0
      x3 = -x1 + 1.0d0
      x4 = x2**0.666666666666667d0 + x3**0.666666666666667d0
      x5 = x4**3
      x6 = 0.306852819440055d0
      x7 = 1d0/x6
      x8 = x4**2
      x9 = 1d0/x8
      x10 = x7*x9
      x11 = gamma_cc*x10
      x12 = 208.945363813799d0
      x13 = rho_c**(-4.66666666666667d0)
      x14 = x12*x13
      x15 = 0.000133775426970164d0*x14
      x16 = 0.682784063255296d0
      x17 = rho_c**(-0.333333333333333d0)*x16
      x18 = 0.186690969707574d0*x17 + 1.0d0
      x19 = 0.466194077035412d0
      x20 = rho_c**(-0.666666666666667d0)*x19
      x21 = 0.564189583547756d0
      x22 = rho_c**(-0.5d0)*x21
      x23 = 0.826307487110758d0
      x24 = rho_c**(-0.166666666666667d0)*x23
      x25 = 5.63098414909788d0*x17 + 0.516066464547863d0*x20 + 2.9152147
     &1421918d0* x22 + 13.4579137143944d0*x24
      x26 = 9.86960440108936d0
      x27 = x26*x7
      x28 = 1.0d0 + x27/x25
      x29 = log(x28)
      x30 = x18*x29
      x31 = 3.25955091942229d0*x17 + 0.406913004517529d0*x20 + 1.4187228
     &1647967d0* x22 + 7.24010193431683d0*x24
      x32 = x27/x31
      x33 = log(0.5d0*x32 + 1.0d0)
      x34 = 0.194159335344114d0*x17 + 1.0d0
      x35 = 2.0d0*x34
      x36 = x33*x35
      x37 = -x30 + x36
      x38 = 1.92366105093154d0*x2**1.33333333333333d0 + 1.92366105093154
     &d0*x3** 1.33333333333333d0 - 3.84732210186307d0
      x39 = rho_c**(-4)
      x40 = rho_s**4
      x41 = x39*x40
      x42 = x38*x41
      x43 = 1d0/x26
      x44 = x43*x6
      x45 = x42*x44
      x46 = x37*x45
      x47 = x36*x44
      x48 = -x41 + 1.0d0
      x49 = x38*x48
      x50 = 0.101077332976288d0*x17 + 1.0d0
      x51 = 3.29180480994506d0*x17 + 0.410025070949612d0*x20 + 0.7623275
     &2193529d0* x22 + 9.87212972256927d0*x24
      x52 = 1.0d0 + 29.6085746432167d0/x51
      x53 = log(x52)
      x54 = x50*x53
      x55 = 0.0197517897025652d0*x54
      x56 = x49*x55
      x57 = -x47 + x56
      x58 = x46 + x57
      x59 = 1d0/x5
      x60 = x27*x59
      x61 = 8.0d0*x60
      x62 = exp(-x58*x61)
      x63 = -x62 + 1.0d0
      x64 = x6**(-2)
      x65 = x64/x63**2
      x66 = gamma_cc**2
      x67 = x4**(-4)
      x68 = x66*x67
      x69 = x65*x68
      x70 = 1d0/x63
      x71 = 14.4549425392770d0
      x72 = rho_c**(-2.33333333333333d0)
      x73 = x71*x72
      x74 = 0.0115661327577615d0*x73
      x75 = x11*x74
      x76 = -x70*x75 + 1.0d0
      x77 = x15*x69 + x76
      x78 = 1d0/x77
      x79 = x74*x76
      x80 = x78*x79
      x81 = x11*x80 + 1.0d0
      x82 = x44*log(x81)
      x83 = x30 - x36
      x84 = -x45*x83 + x57
      x85 = 0.125d0*x5*x82 + x84
      x86 = rho_c**(-1.66666666666667d0)*x19
      x87 = rho_c**(-1.5d0)*x21
      x88 = rho_c**(-1.33333333333333d0)
      x89 = x16*x88
      x90 = rho_c**(-1.16666666666667d0)*x23
      x91 = 0.344044309698576d0*x86 + 1.45760735710959d0*x87 + 1.8769947
     &1636596d0* x89 + 2.24298561906574d0*x90
      x92 = 1d0/x28
      x93 = x25**(-2)
      x94 = x18*x92*x93
      x95 = x91*x94
      x96 = x6/x71
      x97 = x29*x96
      x98 = 0.062230323235858d0*x88
      x99 = x97*x98
      x100 = 0.27127533634502d0*x86 + 0.709361408239834d0*x87 + 1.086516
     &97314076d0* x89 + 1.20668365571947d0*x90
      x101 = x32 + 2.0d0
      x102 = 1d0/x101
      x103 = x31**(-2)
      x104 = x102*x103*x35
      x105 = x100*x104
      x106 = 0.129439556896076d0*x88
      x107 = x33*x96
      x108 = x106*x107
      x109 = -x105 + x108
      x110 = x109 + x95 - x99
      x111 = x110*x42
      x112 = x49*x53
      x113 = 0.000665486074881265d0*x89
      x114 = x112*x113
      x115 = x44*x83
      x116 = rho_c**(-5)
      x117 = x116*x40
      x118 = 4.0d0*x38
      x119 = x117*x118
      x120 = x115*x119
      x121 = x49*x50
      x122 = 1d0/x52
      x123 = x51**(-2)
      x124 = 0.273350047299742d0*x86 + 0.381163760967645d0*x87 + 1.09726
     &826998169d0* x89 + 1.64535495376155d0*x90
      x125 = x122*x123*x124
      x126 = 0.58482233974552d0*x125
      x127 = x121*x126
      x128 = 0.0506609980493537d0*x54
      x129 = x3**0.333333333333333d0
      x130 = x2**0.333333333333333d0
      x131 = x129 - x130
      x132 = x131*x48
      x133 = x128*x132
      x134 = rho_c**(-2)
      x135 = rho_s*x134
      x136 = x133*x135
      x137 = 1d0/x81
      x138 = 0.125d0*x4
      x139 = 1.46459188756152d0
      x140 = gamma_cc*x139
      x141 = x137*x138*x140
      x142 = x62 - 1.0d0
      x143 = x142**(-2)
      x144 = x143*x64
      x145 = x15*x68
      x146 = x144*x145
      x147 = 1d0/x142
      x148 = x147*x75 + 1.0d0
      x149 = x146 + x148
      x150 = 1d0/x149
      x151 = rho_c**(-3.33333333333333d0)
      x152 = 0.0269876431014436d0*x151
      x153 = x148*x152
      x154 = x3**(-0.333333333333333d0)
      x155 = x2**(-0.333333333333333d0)
      x156 = -x155
      x157 = x154 + x156
      x158 = 0.015421510343682d0*x157
      x159 = rho_c**(-4.33333333333333d0)
      x160 = x148*x159
      x161 = 1d0/x4
      x162 = rho_s*x161
      x163 = x160*x162
      x164 = x158*x163
      x165 = x152*x71
      x166 = -x154 + x155
      x167 = x159*x71
      x168 = x162*x167
      x169 = -x46 + x47 - x56
      x170 = exp(x169*x61)
      x171 = x170 - 1.0d0
      x172 = 1d0/x171
      x173 = x172*x72
      x174 = x161*x169
      x175 = 2.0d0*x134
      x176 = x174*x175
      x177 = 1.0d0*x154
      x178 = x155 - x177
      x179 = rho_s*x178
      x180 = x105 - x108
      x181 = x180 - x95 + x99
      x182 = x181*x42
      x183 = x41 - 1.0d0
      x184 = x38*x53
      x185 = x183*x184
      x186 = x113*x185
      x187 = x37*x44
      x188 = x119*x187
      x189 = x38*x50
      x190 = x183*x189
      x191 = x126*x190
      x192 = x131*x183
      x193 = x135*x192
      x194 = x128*x193
      x195 = rho_s**5
      x196 = rho_c**(-6)
      x197 = x195*x196
      x198 = 2.56488140124205d0*x131
      x199 = x197*x198
      x200 = x187*x199
      x201 = x38*x54
      x202 = 0.0790071588102608d0*x201
      x203 = x117*x202
      x204 = x180 - x203
      x205 = -x182 - x186 + x188 + x191 + x194 - x200 + x204
      x206 = x176*x179 + x205
      x207 = x170*x206
      x208 = 142.664564503142d0
      x209 = 0.0925290620620922d0*x208
      x210 = x59*x7
      x211 = x209*x210
      x212 = x165 - 0.015421510343682d0*x166*x168 + x173*x207*x211
      x213 = 0.0115661327577615d0*x11
      x214 = x173*x213
      x215 = x212*x214
      x216 = rho_c**(-5.66666666666667d0)
      x217 = x147*x216
      x218 = x11*x12
      x219 = 0.000624285325860766d0*x218
      x220 = x161*x58
      x221 = x175*x220
      x222 = x156 + x177
      x223 = rho_s*x222
      x224 = x205 + x221*x223
      x225 = x4**(-5)
      x226 = x144*x225
      x227 = x224*x226
      x228 = 2062.20808228389d0
      x229 = 0.00214040683152263d0*x228
      x230 = gamma_cc*x13
      x231 = x230*x62
      x232 = x229*x231
      x233 = rho_c**(-6.66666666666667d0)
      x234 = x147*x233
      x235 = x210*x234
      x236 = gamma_cc*x12
      x237 = 0.000356734471920438d0*x236
      x238 = rho_s*x157
      x239 = x237*x238
      x240 = x158*x71
      x241 = x159*x162*x240
      x242 = x147*x62
      x243 = x224*x242
      x244 = x211*x72
      x245 = x165 + x241 + x243*x244
      x246 = x217*x219 + x227*x232 + x235*x239 + x245
      x247 = x147*x213
      x248 = x148*x150
      x249 = x247*x248*x72
      x250 = x246*x249
      x251 = x153 + x164 + x215 - x250
      x252 = x150*x251
      x253 = x115*x199
      x254 = x154 - 1.0d0*x155
      x255 = x135*x254
      x256 = 0.25d0*x8
      x257 = x256*x82
      x258 = x109 + x203
      x259 = rho_s**3
      x260 = x259*x39
      x261 = x202*x260
      x262 = x0*x133
      x263 = 2.56488140124205d0*x117
      x264 = x115*x131
      x265 = x263*x264
      x266 = 4.0d0*x260
      x267 = x115*x38
      x268 = x266*x267
      x269 = x0*x222
      x270 = x148*x74
      x271 = x150*x270
      x272 = x11*x271 + 1.0d0
      x273 = x44*log(x272)
      x274 = x256*x273
      x275 = x269*x274
      x276 = x151*x158
      x277 = x148*x276
      x278 = x10*x209
      x279 = x161*x254
      x280 = 2.0d0*x279
      x281 = rho_c**(-3)
      x282 = x259*x281
      x283 = x202*x282
      x284 = x115*x41
      x285 = x118*x282
      x286 = x115*x285 + x133 - x198*x284 + x283
      x287 = -x280*x58 + x286
      x288 = x242*x287
      x289 = x240 - x278*x288
      x290 = x217*x289
      x291 = x172*x216
      x292 = x157*x9
      x293 = x292*x7
      x294 = x291*x293
      x295 = x237*x294
      x296 = x171**(-2)
      x297 = x296*x64
      x298 = x229*x297*x67
      x299 = gamma_cc*x216
      x300 = -x129 + x130
      x301 = x183*x300
      x302 = x187*x300
      x303 = x128*x301 - x187*x285 + x283 - 2.56488140124205d0*x302*x41
      x304 = x169*x280 + x303
      x305 = x170*x304
      x306 = x299*x305
      x307 = x298*x306
      x308 = x151*x240
      x309 = x170*x278
      x310 = x172*x304
      x311 = x309*x310
      x312 = x151*x311
      x313 = x308 - x312
      x314 = x295 - x307 + x313
      x315 = x214*x248
      x316 = x213*x290 + x277 - x314*x315
      x317 = 0.125d0*x316
      x318 = 1d0/x272
      x319 = x150*x318
      x320 = x140*x319
      x321 = x317*x320
      x322 = x138*x43
      x323 = x11*x15
      x324 = 0.000267550853940328d0*x14
      x325 = x11*x147
      x326 = x78*(-x323*x70 - x325*x80*(x324*x325 + x74) + x79)
      x327 = x322*x326
      x328 = x132*x135
      x329 = x100*x102
      x330 = x103*x329
      x331 = 5.1297628024841d0*x197
      x332 = x131*x331
      x333 = 8.0d0*x117
      x334 = 0.5d0*x255
      x335 = x137*x140
      x336 = x252*x335
      x337 = x110*x38
      x338 = x110*x131
      x339 = rho_c**(-2.33333333333333d0)
      x340 = x16*x339
      x341 = 0.000887314766508353d0*x340
      x342 = x2**(-0.666666666666667d0)
      x343 = 0.854960467080683d0*x1
      x344 = x342*x343
      x345 = x3**(-0.666666666666667d0)
      x346 = x343*x345
      x347 = x344 + x346
      x348 = -5.1297628024841d0*x129 + 5.1297628024841d0*x130 + x347
      x349 = x195/rho_c**7
      x350 = x348*x349
      x351 = x196*x40
      x352 = x115*x351
      x353 = 20.0d0*x38
      x354 = 0.0899588103381452d0*x159
      x355 = x162*x76
      x356 = rho_c**(-5.33333333333333d0)
      x357 = x157*x356
      x358 = 0.0719670482705162d0*x357
      x359 = x76*x9
      x360 = rho_s**2
      x361 = x157**2
      x362 = 0.0308430206873641d0*x361
      x363 = rho_c**(-6.33333333333333d0)*x360*x362
      x364 = x2**(-1.33333333333333d0)
      x365 = 0.444444444444444d0*x1
      x366 = x364*x365
      x367 = x3**(-1.33333333333333d0)
      x368 = x365*x367
      x369 = x366 + x368
      x370 = 2.66666666666667d0*x154 - 2.66666666666667d0*x155
      x371 = 0.0115661327577615d0*x356*(x369 + x370)
      x372 = 0.0539752862028871d0*x151
      x373 = rho_s*x147
      x374 = 0.0308430206873641d0*x157
      x375 = gamma_cc*x374
      x376 = x210*x375
      x377 = x216*x70
      x378 = x210*x70
      x379 = x233*x378
      x380 = x70*x72
      x381 = x162*x222
      x382 = x111 + x114 - x120 - x127 - x136 + x175*x381*x84 + x204 + x
     &253
      x383 = exp(-x61*x84)
      x384 = x382*x383
      x385 = x380*x384
      x386 = x225*x230*x384*x65
      x387 = -x165 + x211*x385 + x219*x377 - x229*x386 + x239*x379 - x24
     &1
      x388 = x387*x78
      x389 = gamma_cc*x7
      x390 = x359*x389
      x391 = rho_s*x159
      x392 = x147*x64
      x393 = x392*x68
      x394 = x151*x71
      x395 = 0.00124857065172153d0*x218
      x396 = 0.000713468943840876d0*x236
      x397 = x238*x396
      x398 = x208*x210
      x399 = 0.00428081366304526d0*x228
      x400 = 0.0115661327577615d0*x72
      x401 = x354*x71
      x402 = x161*x71
      x403 = rho_s*x402
      x404 = x358*x403
      x405 = x71*x9
      x406 = x363*x405
      x407 = x371*x403
      x408 = x151*x208
      x409 = 0.431802289623097d0*x408
      x410 = 16.0d0*x60
      x411 = 1408.04281369971d0
      x412 = 1.48046499299348d0*x411
      x413 = x4**(-6)
      x414 = x382**2*x413
      x415 = 0.740232496496738d0*x411
      x416 = x380*x383
      x417 = 0.246744165498913d0*x157
      x418 = x67*x7
      x419 = x208*x391*x417*x418
      x420 = x181*x38
      x421 = x333*x420
      x422 = x181*x332
      x423 = x182 + x186 - x188 - x191 - x194 + x200 + x258
      x424 = 4.0d0*x134*x381*x423
      x425 = 0.333333333333333d0*x1
      x426 = x364*x425
      x427 = x367*x425
      x428 = x426 + x427
      x429 = 2.0d0*x281
      x430 = rho_s*x220*x429*(2.0d0*x154 - 2.0d0*x155 + x428)
      x431 = x185*x341
      x432 = x187*x350
      x433 = x187*x351
      x434 = x353*x433
      x435 = 17.3157558993759d0*x124**2/(x51**4*x52**2)
      x436 = x190*x435
      x437 = 0.58482233974552d0*x122
      x438 = x190*x437
      x439 = rho_c**(-2.66666666666667d0)*x19
      x440 = rho_c**(-2.5d0)*x21
      x441 = rho_c**(-2.16666666666667d0)*x23
      x442 = x123*(1.46302435997558d0*x340 + 0.455583412166236d0*x439 + 
     &0.571745641451468d0*x440 + 1.91958077938847d0*x441)
      x443 = x438*x442
      x444 = x360*x39
      x445 = 5.33333333333333d0*x292
      x446 = x445*x58
      x447 = x222*x444*x446
      x448 = 0.00341378571249706d0*rho_c**(-3.33333333333333d0)*rho_s*x1
     &6*x53
      x449 = x192*x448
      x450 = rho_s*x281
      x451 = x348*x450*x55
      x452 = x183*x451
      x453 = 20.5190512099364d0*x349
      x454 = x131*x187*x453
      x455 = 0.0394081882442864d0*x125*x89
      x456 = x183*x38*x455
      x457 = x124*(0.546700094599483d0*x86 + 0.76232752193529d0*x87 + 2.
     &19453653996337d0*x89 + 3.29070990752309d0*x90)/x51**3
      x458 = x438*x457
      x459 = x125*x50
      x460 = 2.99999988448829d0*x459
      x461 = x193*x460
      x462 = x91*x92
      x463 = 1d0/x139
      x464 = x462*x93
      x465 = x104*(1.44868929752102d0*x340 + 0.452125560575033d0*x439 + 
     &1.06404211235975d0*x440 + 1.40779759833938d0*x441)
      x466 = 0.172586075861435d0*x107*x339
      x467 = x329*x35*(0.542550672690039d0*x86 + 1.41872281647967d0*x87 
     &+ 2.17303394628153d0*x89 + 2.41336731143894d0*x90)/x31**3
      x468 = x106*x330*x463
      x469 = 0.129439556896076d0*x330*x89
      x470 = x100**2*x27*x35/(x101**2*x31**4)
      x471 = -x465 + x466 + x467 - x468 - x469 - x470
      x472 = x42*(-x18*x462*(0.688088619397151d0*x86 + 2.91521471421918d
     &0*x87 + 3.75398943273192d0*x89 + 4.48597123813148d0*x90)/x25**3 + 
     &x18*x27 *x91**2/(x25**4*x28**2) - 0.0829737643144773d0*x339*x97 + 
     &x463* x464*x98 + 0.062230323235858d0*x464*x89 + x471 + x94*( 2.502
     &65962182128d0*x340 + 0.573407182830959d0*x439 + 2.18641103566438d0
     &*x440 + 2.6168165555767d0*x441))
      x473 = x131*x54
      x474 = 0.40528798439483d0*x473
      x475 = x349*x474
      x476 = x16*x184
      x477 = 0.00532388859905012d0*rho_c**(-6.33333333333333d0)*x40*x476
     &
      x478 = 0.395035794051304d0*x201*x351
      x479 = x125*x189
      x480 = 4.67857871796416d0*x117*x479
      x481 = x465 - x466 - x467 + x468 + x469 + x470 + x472 + x475 - x47
     &7 - x478 + x480
      x482 = x218*x234
      x483 = rho_c**(-7.66666666666667d0)
      x484 = x210*x236
      x485 = x483*x484
      x486 = 0.00118911490640146d0*x361
      x487 = 0.888888888888889d0*x1
      x488 = x364*x487 + x367*x487
      x489 = x210*x243
      x490 = x228*x62
      x491 = x227*x299*x490
      x492 = exp(-x410*x58)
      x493 = x412*x492
      x494 = x144*x413
      x495 = x224**2
      x496 = x495*x72
      x497 = x242*x415
      x498 = x495/x4**8
      x499 = 20353.1779648712d0/x6**3
      x500 = 0.0513697639565431d0*x499
      x501 = x492*x500/x142**3
      x502 = 0.017123254652181d0*x499
      x503 = x143*x502
      x504 = gamma_cc*x233
      x505 = x490*x504
      x506 = x421 - x422 + x424 - x430 + x431 - x432 - x434 - x436 - x44
     &3 - x447 - x449 + x452 + x454 - x456 + x458 + x461 + x471 - x472 -
     & x475 + x477 + x478 - x480
      x507 = x121*x437
      x508 = x149**(-2)
      x509 = x508*x66
      x510 = 0.125d0*x161*x7
      x511 = x251*x510
      x512 = -x153 - x164 - x215 + x250
      x513 = 21.1705915781930d0
      x514 = x512*x513
      x515 = 0.333333333333333d0*x157*x4
      x516 = x254*x515
      x517 = 0.00266194429952506d0*rho_c**(-5.33333333333333d0)*x259*x47
     &6
      x518 = 0.00170689285624853d0*x340*x53
      x519 = x116*x259
      x520 = 0.316028635241043d0*x201*x519
      x521 = 2.56488140124205d0*x130
      x522 = 2.56488140124205d0*x129
      x523 = x347 + x521 - x522
      x524 = x134*x55
      x525 = 2.33928935898208d0*x260*x479
      x526 = 1.49999994224414d0*x0*x459
      x527 = 16.0d0*x519
      x528 = x269*x320
      x529 = x172*x75 + 1.0d0
      x530 = x145*x297 + x529
      x531 = 1d0/x530
      x532 = x529*x531
      x533 = x150*x531*x66*(x213*x291*(x240 - x311) + x214*x532*(-x295 +
     & x307 - x308 + x312) + x276*x529)/x272**2
      x534 = 0.0359835241352581d0*x157
      x535 = x161*x362
      x536 = rho_s*x356
      x537 = 1.33333333333333d0*x154
      x538 = 1.33333333333333d0*x155
      x539 = 0.0115661327577615d0*x369 + 0.0115661327577615d0*x537 - 0.0
     &115661327577615d0*x538
      x540 = gamma_cc*x158
      x541 = x11*x172
      x542 = x212*x541
      x543 = x150*x314
      x544 = x172*x210
      x545 = rho_s*x160*x544
      x546 = x543*x68
      x547 = x212*x297
      x548 = x150*x246
      x549 = 0.0115661327577615d0*x68
      x550 = x157*x394
      x551 = x10*x310
      x552 = x294*x396 - x297*x306*x399*x67
      x553 = x148*(-0.185058124124184d0*x170*x408*x551 + 0.0308430206873
     &641d0*x550 + x552)
      x554 = x246*x508
      x555 = x167*x534
      x556 = x159*x170
      x557 = 0.215901144811548d0*x208
      x558 = x310*x398
      x559 = 0.123372082749456d0*x157*x408
      x560 = exp(x169*x410)
      x561 = x225*x297
      x562 = x412*x561
      x563 = x225*x64
      x564 = x415*x563
      x565 = x151*x564
      x566 = x0*x280
      x567 = -x344 - x346 - x521 + x522
      x568 = 0.202643992197415d0*x351
      x569 = x300*x54
      x570 = x187*x38
      x571 = 10.2595256049682d0*x433
      x572 = -x131*x571 - x181*x263*x300 + x183*x524*x567 - x266*x420 + 
     &x300*x571 - x301*x518 + x301*x526 - x433*x567 + x473*x568 - x517 -
     & x520 + x525 + x527*x570 - x568*x569
      x573 = x362*x402
      x574 = x236*x293
      x575 = x484*x486
      x576 = x144*x67
      x577 = x288*x398
      x578 = x226*x493
      x579 = x224*x287
      x580 = x4**(-7)
      x581 = x299*x579*x580
      x582 = x221*(x222 + x428) + x223*x281*x446 - x286*x381*x429 - x423
     &*x566 + x572
      x583 = x242*x278
      x584 = 0.125d0*x320
      x585 = 0.237021476430782d0*x201
      x586 = x342 + x345
      x587 = 0.0168869993497846d0*x54*x586
      x588 = x48*x587
      x589 = 0.854960467080683d0*x586
      x590 = x364 + x367
      x591 = x134*x273
      x592 = 0.00514050344789401d0*x590
      x593 = x248*x314
      x594 = x172*x290
      x595 = x592*x71
      x596 = x287**2
      x597 = x134*x360
      x598 = x585*x597
      x599 = 20.5190512099364d0*x282
      x600 = 12.0d0*x597
      x601 = 0.666666666666667d0*x590
      x602 = x254*x445
      x603 = 4.0d0*x279
      x604 = x172*x233
      x605 = x304**2
      x606 = x560*x605
      x607 = x504*x580
      x608 = x169*x602 + x174*x601 + x183*x587 - x187*x41*x589 + 0.40528
     &798439483d0* x282*x569 - x302*x599 + x303*x603 - x570*x600 + x598
      x609 = 0.25d0*x43
      x610 = x324*x541
      x611 = x610 + x74
      x612 = x541*x611
      x613 = x147*x323 + x270 - x271*x612
      x614 = x153*x71
      x615 = x150*x611
      x616 = x541*x615
      x617 = 0.0231322655155231d0*x73
      x618 = x615*x68
      x619 = x271*x325
      x620 = 0.000535101707880657d0*x14*x541 + x617
      x621 = x529*x74
      x622 = x531*x611
      x623 = x172*x323 - x541*x621*x622 + x621
      x624 = x318*x531
      x625 = 0.00192768879296025d0*x148*x550
      x626 = 0.00144576659472019d0*x73
      x627 = x541*x626
      E = rho_c*x85
      d1E(1) = rho_c*(-x111 - x114 + x120 + x127 + x136 - x141*x252 - x2
     &53 + x255*x257 + x258) + x85
      d1E(2) = -rho_c*(x261 + x262 - x265 + x268 + x275 - x321)
      d1E(3) = rho_c*x137*x327
      d2E(1) = rho_c*(x112*x341 - x115*x350 - x121*x435 - x132*x448 + x1
     &41*x78*(-x147* x390*x400*x78*(rho_c**(-8.66666666666667d0)*x147*x2
     &36*x360*x418* x486 + 0.00332952173792409d0*x147*x238*x485 + 0.0114
     &15503101454d0 *x224*x238*x494*x505 - x226*x232*x506 + x230*x498*x5
     &01 - x231* x498*x503 - x242*x244*x506 + x243*x419 + 0.000133775426
     &970164d0* x373*x485*(5.33333333333333d0*x154 - 5.33333333333333d0*
     &x155 + x488) + x401 + x404 + x406 + x407 + x409*x489 - x413*x496*x
     &497* x64 + 0.00353761684654434d0*x482 + 0.0199771304275445d0*x491 
     &+ x493*x494*x496) + x159*x245*x373*x376 + x213*x380*(x211*x416*( -
     &x421 + x422 - x424 + x430 - x431 + x432 + x434 + x436 + x443 + x44
     &7 + x449 - x452 - x454 + x456 - x458 - x461 + x481) + x378* x384*x
     &409 + x384*x419*x70 - x401 - x404 - x406 - x407 - x412*x414 *x65*x
     &72*exp(-x410*x84) - x414*x415*x416*x64) + x245*x325*x372 - 0.02313
     &22655155231d0*x245*x380*x388*x393 + x354*x76 + x355*x358 + x355*x3
     &71 + x359*x363 - x372*x388*x390*x70 - x375*x378*x388*x391* x76 + x
     &387*x400*x69*x76*(-x168*x374 + x377*x395 + x379*x397 + 0.185058124
     &124184d0*x385*x398 - x386*x399 - 0.0539752862028871d0* x394)/x77**
     &2) - x257*x450*(2.0d0*x154 - 2.0d0*x155 + x428) + x264 *x453 + x32
     &8*x460 - x331*x338 + x333*x337 - x334*x336 - x352*x353 - x442*x507
     & + x444*x516*x82 + x451*x48 - x455*x49 + x457*x507 + x481 + x509*x
     &511*x514/x81**2) + 0.258879113792152d0*x107*x88 - 2.0d0*x111 - 0.0
     &0133097214976253d0*x112*x89 - x115*x332 + 0.158014317620522d0*x117
     &*x201 + 1.16964467949104d0*x121*x125 + x267*x333 + 0.1013219960987
     &07d0*x328*x54 - 4.0d0*x330*x34 + x334* x8*x82 - 0.25d0*x336*x4
      d2E(2) = rho_c*(-0.125d0*x10*x514*x533 - 20.5190512099364d0*x131*x
     &352 + x132*x518 - x132*x526 + x134*x274*(x254 + x428) + 0.25d0*x13
     &5*x279*x316* x320 + x263*x338 - x266*x337 + x267*x527 - x273*x450*
     &x516 - x351* x474 + x352*x523 - x48*x523*x524 - 0.25d0*x512*x528 +
     & x517 + x520 - x525 + x584*(-rho_c**(-7.66666666666667d0)*x210*x28
     &9*x373*x540 + x144*x216*x289*x548*x549 - x148*x535*x536 + x153*x54
     &1*x543 - x160*x534 - x160*x539 - x173*x392*x549*x553*x554 - x214*(
     &-x151* x206*x304*x560*x562 + 0.123372082749456d0*x166*x170*x536*x5
     &58 - 0.0308430206873641d0*x166*x357*x403 - 0.0115661327577615d0*x1
     &67*( -x366 - x368 - x537 + x538) + x173*x309*(x162*x178*x303*x429 
     &+ x169*x179*x281*x445 + x176*(x178 - x426 - x427) + x205*x566 + x5
     &72) + x207*x310*x565 + x207*x544*x559 - x551*x556*x557 + x555) - 0
     &.0269876431014436d0*x233*x289*x325 + x249*( -0.00570775155072701d0
     &*gamma_cc*x226*x238*x287*x483*x490 - 0.123372082749456d0*rho_s*x35
     &7*x577 - x10*x159*x288*x557 - x151* x578*x579 + 0.0057077515507270
     &1d0*x157*x491 + x167*x539 + x224* x288*x565 + x232*x576*x582 + 0.0
     &0166476086896204d0*x234*x574 - 0.00998856521377226d0*x287*x505*x57
     &6 + x373*x483*x575 + 0.000133775426970164d0*x482*(x370 + x488) + x
     &489*x559 - x501*x581 + x503*x581*x62 + x536*x573 + x555 + x582*x58
     &3*x72) - x276*x542 + x277*x325*x548 + x400*x546*x547 + x540*x543*x
     &545)) - x261 - x262 + x265 - x268 - x275 + x321
      d2E(3) = -rho_c*(-x134*x588 + 0.5d0*x161*x316*x528 + x210*x317*x51
     &3*x533 - x222* x515*x591 - 20.5190512099364d0*x264*x519 + 12.0d0*x
     &267*x444 + x352*x589 + x444*x585 - x474*x519 - x584*(rho_c**( -6.6
     &6666666666667d0)*x247*(-x417*x577 - x497*x563*x596 + x573 + x578*x
     &596 - x583*(-x220*x601 - x264*x599 + x267*x600 - x282*x474 + x284*
     &x589 + x286*x603 - x58*x602 - x588 + x598) + x595) - x151* x172*x3
     &76*x593 + x160*x535 + x160*x592 + x235*x289*x375 + x314* x400*x509
     &*x553*x561 - x315*(-0.011415503101454d0*x157*x228*x305* x504*x561 
     &- x159*x172*x309*x608 + x159*x562*x606 + x159*x595 + x167*x535 - x
     &170*x296*x502*x605*x607 - x170*x298*x504*x608 - x172 *x556*x564*x6
     &05 + 0.000118911490640146d0*x218*x590*x604 - x417* x556*x558 + x57
     &5*x604 + x500*x606*x607/x171**3) - 0.0231322655155231d0*x543*x563*
     &x594*x66) + 0.0833333333333333d0* x590*x591*x8)
      d2E(4) = x137*(rho_c*(-x150*x322*(-gamma_cc*x240*x545*x615 - x146*
     &x548 + x163* x240 + x172*x270*x393*x554*x620 + 0.00031214266293038
     &3d0*x217* x218 + 0.000178367235960219d0*x235*x236*x238 - x246*x619
     & + x542* x617 - x547*x618*x74 - x614*x616 + x614 - x619*(x217*x395
     & + x227* x231*x399 + x235*x397 + x245)) + x255*x326*x609 + x335*x5
     &08*x511* x613) + x327)
      d2E(5) = -rho_c*x319*(x10*x140*x317*x623*x624 + x269*x609*x613 - x
     &43*( -1.67219283712705d-5*x14*x172*x392*x546 + x148*x297*x314*x508
     &* x620*x626*x68 + 2.22959044950274d-5*x217*x574 - x248*x627*(x313 
     &+ x552) + 0.00289153318944038d0*x290*x389*x405 - x593*x627 - 0.001
     &44576659472019d0*x594*x618*x64*x71 - x616*x625 + x625))
      d2E(6) = -rho_c*x43*x510*x624*(x172*(0.00934638406407122d0*rho_c**
     &(-7.0d0)*x532* x541 - x324 + x532*x611*x617 + x610*x622 - x612*x62
     &0*x621/x530**2 ) + x319*x613*x623)
      end subroutine


C*****************************************************************************
      pure subroutine D2ESRC_PBE_singletref_triplet(rho_c, gamma_cc, E, 
     &d1E, d2E)
C*****************************************************************************
C   Implemented by E.R. Kjellgren.
C
C   Subroutine generated using Sympy 1.3
C   Generated: March 25, 2019
C*****************************************************************************
      implicit none
      real*8, intent(in) :: rho_c, gamma_cc
      real*8, intent(out) :: E, d1E(9), d2E(45)
      real*8 :: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x
     &13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x2
     &6, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39
     &, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x50, x51, x52,
     & x53, x54, x55, x56, x57, x58, x59, x60, x61, x62, x63, x64, x65, 
     &x66, x67, x68, x69, x70, x71, x72, x73, x74, x75, x76, x77, x78, x
     &79, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x90, x91, x9
     &2, x93, x94, x95, x96, x97, x98, x99, x100, x101, x102, x103, x104
     &, x105, x106, x107, x108, x109, x110, x111, x112, x113, x114, x115
     &, x116, x117, x118, x119, x120, x121, x122, x123, x124, x125, x126
     &, x127, x128, x129, x130, x131, x132, x133, x134, x135, x136, x137
     &
      E = 0.0d0
      d1E(:) = 0.0d0
      d2E(:) = 0.0d0
      x0 = 0.682784063255296d0
      x1 = rho_c**(-0.333333333333333d0)*x0
      x2 = 0.194159335344114d0*x1 + 1.0d0
      x3 = 0.466194077035412d0
      x4 = rho_c**(-0.666666666666667d0)*x3
      x5 = rho_c**(-0.5d0)
      x6 = 0.564189583547756d0
      x7 = 1.41872281647967d0*x6
      x8 = 0.826307487110758d0
      x9 = rho_c**(-0.166666666666667d0)*x8
      x10 = 3.25955091942229d0*x1 + 0.406913004517529d0*x4 + x5*x7 + 7.2
     &4010193431683d0*x9
      x11 = 9.86960440108936d0
      x12 = 0.306852819440055d0
      x13 = 1d0/x12
      x14 = x11*x13
      x15 = x14/x10
      x16 = log(0.5d0*x15 + 1.0d0)
      x17 = x16*x2
      x18 = 2.0d0*x17
      x19 = gamma_cc*x13
      x20 = 208.945363813799d0
      x21 = rho_c**(-4.66666666666667d0)
      x22 = x20*x21
      x23 = 8.36096418563526d-6*x22
      x24 = gamma_cc**2
      x25 = x12**(-2)
      x26 = exp(x18)
      x27 = x26 - 1.0d0
      x28 = x27**(-2)
      x29 = x25*x28
      x30 = x24*x29
      x31 = x23*x30
      x32 = 14.4549425392770d0
      x33 = rho_c**(-2.33333333333333d0)
      x34 = x32*x33
      x35 = 0.00289153318944038d0*x34
      x36 = 1d0/x27
      x37 = x19*x36
      x38 = x35*x37 + 1.0d0
      x39 = x31 + x38
      x40 = 1d0/x39
      x41 = x35*x38
      x42 = x40*x41
      x43 = x19*x42 + 1.0d0
      x44 = log(x43)
      x45 = 1.0d0*x44
      x46 = 1d0/x11
      x47 = x12*x46
      x48 = rho_c**(-5.66666666666667d0)
      x49 = x20*x37
      x50 = x48*x49
      x51 = 3.90178328662979d-5*x50
      x52 = rho_c**(-1.33333333333333d0)
      x53 = 0.129439556896076d0*x52
      x54 = x12*x16/x32
      x55 = x53*x54
      x56 = 2.0d0*x2
      x57 = x15 + 2.0d0
      x58 = 1d0/x57
      x59 = x10**(-2)
      x60 = rho_c**(-1.66666666666667d0)*x3
      x61 = rho_c**(-1.5d0)
      x62 = x0*x52
      x63 = rho_c**(-1.16666666666667d0)*x8
      x64 = 0.709361408239834d0*x6*x61 + 0.27127533634502d0*x60 + 1.0865
     &1697314076d0 *x62 + 1.20668365571947d0*x63
      x65 = x58*x59*x64
      x66 = x56*x65
      x67 = -x55 + x66
      x68 = 2062.20808228389d0*x29
      x69 = gamma_cc*x21
      x70 = 1.67219283712705d-5*x26*x69
      x71 = x68*x70
      x72 = rho_c**(-3.33333333333333d0)
      x73 = 0.00674691077536089d0*x72
      x74 = x32*x73
      x75 = 0.00289153318944038d0*x36
      x76 = x33*x75
      x77 = x26*x76
      x78 = 142.664564503142d0*x13
      x79 = x77*x78
      x80 = x67*x79 + x74
      x81 = x51 + x67*x71 + x80
      x82 = x19*x76
      x83 = x38*x40
      x84 = x82*x83
      x85 = x38*x73
      x86 = x80*x82 + x85
      x87 = -x81*x84 + x86
      x88 = x40/x43
      x89 = 1.0d0*x88
      x90 = 1.46459188756152d0
      x91 = gamma_cc*x90
      x92 = 1.67219283712705d-5*x22
      x93 = x37*x92
      x94 = x35 + x93
      x95 = x37*x42
      x96 = x23*x37 + x41 - x94*x95
      x97 = x46*x96
      x98 = rho_c*x89
      x99 = x55 - x66
      x100 = x26*x99
      x101 = x100*x68
      x102 = x101*x69
      x103 = x74 - x79*x99
      x104 = -1.67219283712705d-5*x102 + x103 + x51
      x105 = -x104*x84
      x106 = x105 + x86
      x107 = x88*x91
      x108 = rho_c**(-4.33333333333333d0)
      x109 = 0.0224897025845363d0*x108
      x110 = 0.0134938215507218d0*x72
      x111 = x110*x37
      x112 = 0.00578306637888076d0*x33
      x113 = x104*x30
      x114 = x39**(-2)
      x115 = 7.80356657325958d-5*x50
      x116 = x100*x36*x78
      x117 = exp(4.0d0*x17)
      x118 = x99**2
      x119 = 1408.04281369971d0*x118
      x120 = rho_c**(-2.33333333333333d0)
      x121 = x56*x58
      x122 = -0.172586075861435d0*x120*x54 + x121*x59*(0.452125560575033
     &d0*rho_c**( -2.66666666666667d0)*x3 + 1.06404211235975d0*rho_c**(-
     &2.5d0)*x6 + 1.40779759833938d0*rho_c**(-2.16666666666667d0)*x8 + 1
     &.44868929752102d0*x0*x120) + x53*x65/x90 + 0.129439556896076d0* x6
     &2*x65 - x121*x64*(0.542550672690039d0*x60 + x61*x7 + 2.17303394628
     &153d0*x62 + 2.41336731143894d0*x63)/x10**3 + x14*x56 *x64**2/(x10*
     &*4*x57**2)
      x123 = x109*x32 - x110*x116 + x112*x117*x119*x29 - x119*x25*x77 + 
     &x122*x79
      x124 = rho_c**(-6.66666666666667d0)
      x125 = x124*x49
      x126 = 20353.1779648712d0*x118/x12**3
      x127 = rho_c**(-2)
      x128 = 0.0337739986995691d0*(0.101077332976288d0*x1 + 1.0d0)*log(1
     &.0d0 + 29.608574643216677d0/(3.2918048099450625d0*x1 + 0.410025070
     &94961249d0*x4 + 0.76232752193529008d0*x5*x6 + 9.8721297225692712d0
     &*x9))
      x129 = x108*x32
      x130 = 0.0012851258619735d0*x129
      x131 = x26*(x128*x14 - 1.33333333333333d0*x17)
      x132 = x131*x75
      x133 = x19*x20
      x134 = x32*x85
      x135 = 0.00578306637888076d0*x34
      x136 = x40*x94
      x137 = x114*x41*(x135 + 3.34438567425411d-5*x22*x37)
      E = -rho_c*x47*(x18 - x45)
      d1E(1) = -rho_c*(x67 + x87*x89*x91) - x18*x47 + x45*x47
      d1E(3) = x97*x98
      d2E(1) = rho_c*(-21.170591578193d0*x106*x114*x13*x24*(x103*x82 + x
     &105 + x85)/x43 **2 + x107*(x103*x111 - x103*x112*x113*x40 - x104*x
     &111*x83 + x109 *x38 + 0.00289153318944038d0*x113*x114*x33*x38*( -3
     &.34438567425411d-5*x102 + x110*x32 - x112*x116 + x115) + x123* x82
     & - x84*(-0.000156071331465192d0*gamma_cc*x101*x48 + 5.016578511381
     &16d-5*x117*x126*x69/x27**3 + x122*x71 + x123 + 0.00022110105290902
     &1d0*x125 - x126*x28*x70)) + x122) - 2.0d0*x106 *x107 - 4.0d0*x2*x6
     &5 + 0.258879113792152d0*x52*x54
      d2E(3) = rho_c*(gamma_cc*x46*x89*(rho_c**(-6.66666666666667d0)*x13
     &3*x75*(x132 + 0.0012851258619735d0) + x130*x38 - x95*(1.6721928371
     &2705d-5*x124* x131*x133*x28 + 7.43196816500912d-6*x125 + x129*x132
     & + x130)) + x127*x128 - 0.666666666666667d0*x127*x44*x47)
      d2E(4) = x89*(-rho_c*(-x107*x13*x87*x96 + x46*(-x134*x136*x37 + x1
     &34 + x135*x37* x80 - x136*x30*x35*x80 + x137*x30*x81 - x31*x40*x81
     & + 1.9508916433149d-5*x50 - x81*x95 - x95*(x115 + 3.34438567425411
     &d-5*x26*x67*x68*x69 + x80))) + x97)
      d2E(6) = -x13*x46*x98*(x36*(0.000146037251001113d0*rho_c**(-7.0d0)
     &*x37*x83 + x135 *x83*x94 + x136*x93 - x137*x37*x94 - x92) + x88*x9
     &6**2)
      end subroutine
